package com.example.helloworld.demo;

import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import java.net.Inet4Address;
import java.net.UnknownHostException;

@Controller
public class DemoController {
    @GetMapping("/getArms")
    public ResponseEntity<String> getArms(){
        return ResponseEntity.ok("Navy");
    }
    @GetMapping("/getIp")
    public ResponseEntity<String> getIp(){
        String ip = null;
        try {
            ip = Inet4Address.getLocalHost().getHostAddress();
        } catch (UnknownHostException e) {
            e.printStackTrace();
        }
        return ResponseEntity.ok(ip);
    }
}
